﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.IO;
using MvcEngine.Core.Content;
using MvcEngine.Core.Common;
using MvcEngine.Core.Account;
using MvcEngine.Core.Website;

namespace MvcEngine.LinqToSqlProvider
{
    public static class DataContextExtensions
    {
        #region Content
        
        public static Table<Page> Pages(this DataContext context)
        {
            return context.GetTable<Page>();
        }

        public static Table<Control> Controls(this DataContext context)
        {
            return context.GetTable<Control>();
        }

        public static Table<Container> Containers(this DataContext context)
        {
            return context.GetTable<Container>();
        }

        public static Table<Module> Modules(this DataContext context)
        {
            return context.GetTable<Module>();
        }

        public static Table<PageContent> PageContents(this DataContext context)
        {
            return context.GetTable<PageContent>();
        }

        #endregion

        #region Account
        
        public static Table<Permission> Permissions(this DataContext context)
        {
            return context.GetTable<Permission>();
        }

        public static Table<ControlPermission> ControlPermissions(this DataContext context)
        {
            return context.GetTable<ControlPermission>();
        }

        public static Table<PagePermission> PagePermissions(this DataContext context)
        {
            return context.GetTable<PagePermission>();
        }

        public static Table<Role> Roles(this DataContext context)
        {
            return context.GetTable<Role>();
        }

        public static Table<User> Users(this DataContext context)
        {
            return context.GetTable<User>();
        }

        public static Table<UserInRole> UserInRoles(this DataContext context)
        {
            return context.GetTable<UserInRole>();
        } 

        #endregion

        #region Website

        public static Table<Site> Sites(this DataContext context)
        {
            return context.GetTable<Site>();
        }

        public static Table<SiteDomain> SiteDomains(this DataContext context)
        {
            return context.GetTable<SiteDomain>();
        }

        public static Table<Skin> Skins(this DataContext context)
        {
            return context.GetTable<Skin>();
        }

        public static Table<SkinTemplate> SkinTemplates(this DataContext context)
        {
            return context.GetTable<SkinTemplate>();
        }

        #endregion

        #region Common
        
        public static Table<Log> Logs(this DataContext context)
        {
            return context.GetTable<Log>();
        } 

        #endregion
    }
}
